package com.siloam.module;

import java.text.SimpleDateFormat;
import java.util.Date;
/**
 * 文章
 * 包含 标题、内容、发表日期、文章类型和作者
 * @author rzpeng
 *
 */
public class Article {
	/**
	 * 个人文章
	 */
	public static final int TYPE_PERSON_ARTICLE = 1;
	
	/**
	 * 团契公告
	 */
	public static final int TYPE_SILOAM_NOTIC = 2;
	
	/**
	 * 聚会记录
	 */
	public static final int TYPE_MEET_RECORD = 3;
	
	private int id;
	private String title;
	private String content;
	private Date date;
	private int articleType;
	private ArticleCategory articleCategory;
	
	private User author;
	
	public int getId() {
		return id;
	}
	public void setId(int id) {
		this.id = id;
	}
	public String getTitle() {
		return title;
	}
	public void setTitle(String title) {
		this.title = title;
	}
	public String getContent() {
		return content;
	}
	public void setContent(String content) {
		this.content = content;
	}
	public Date getDate() {
		return date;
	}
	public void setDate(Date date) {
		this.date = date;
	}
	public User getAuthor() {
		return author;
	}
	public void setAuthor(User author) {
		this.author = author;
	}
	public String getDateText(SimpleDateFormat sdf){
		return sdf.format(date);
	}
	public ArticleCategory getArticleCategory() {
		return articleCategory;
	}
	public void setArticleCategory(ArticleCategory articleCategory) {
		this.articleCategory = articleCategory;
	}
	public int getArticleType() {
		return articleType;
	}
	public void setArticleType(int articleType) {
		this.articleType = articleType;
	}
	
	public String articleTypeText(){
		if(articleType == TYPE_PERSON_ARTICLE){
			return "个人文章";
		} else if(articleType == TYPE_SILOAM_NOTIC){
			return "团契公告";
		} else if(articleType == TYPE_MEET_RECORD){
			return "聚会记录";
		} else {
			return "";
		}
	}
}
